package ThreadPoolDemo.bilibiliThread;

import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;

public class TestDemoThree {

	public static void main(String[] args) {
		Executors.newScheduledThreadPool(1).scheduleAtFixedRate(
				new TicketJobInlet(), 5, 1, TimeUnit.SECONDS);// 空闲时，60秒扫描一次

	}
}

class TicketJobInlet implements Runnable {

	@Override
	public void run() {
		System.out.println("启动线程任务" + Thread.currentThread().getName());
		if (1 == 1) {

			System.out.println(Thread.currentThread().getName());
			try {
				Thread.sleep(10000);
				System.out.println("任务执行完毕");
			} catch (InterruptedException e) {
				e.printStackTrace();
			}

			System.out.println(Thread.currentThread().getName());
		}

	}

}
